package com.xsr.service.impl;

import com.xsr.mapper.UserMapper;
import com.xsr.pojo.User;
import com.xsr.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project xiaomi
 * @date 2022/9/13 17:47
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
     private UserMapper userMapper;
    @Override
    public User findUserByUsernameAndPwd(String username, String password) {
        return userMapper .selectByNameAndPwd(username,password);

    }

    @Override
    public User findByUsername(String username) {
        return userMapper.selectByName(username);
    }

    @Override
    public boolean saveUser(User user) {
        int i = userMapper.addUser(user);
        if(i!=0){
            return true;
        }
        return false;
    }
}
